From cf7a730781913d44dc7b428bd9a2be4b8faa2434 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Caol=C3=A1n=20McNamara?= Date: Wed, 6 May 2026 15:37:30 +0100 Subject: [PATCH] [PATCH] check for hb_shape_full failure MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Caolán McNamara Change-Id: I5fafcb7d592fb4c9091cb2bab64cb6ac47462d71 Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/2102 Reviewed-by: Miklos Vajna (cherry picked from commit 22c19be8fae977a90f83a82d8acccd0b46c7cf20) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204946 Tested-by: Jenkins Reviewed-by: Julien Nabet Gbp-Pq: Name check-for-hb_shape_full-failure.diff --- vcl/source/gdi/CommonSalLayout.cxx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx index b40851a2f18..dc7dd332cef 100644 --- a/vcl/source/gdi/CommonSalLayout.cxx +++ b/vcl/source/gdi/CommonSalLayout.cxx @@ -203,10 +203,11 @@ public: // The shapers that we want HarfBuzz to use, in the order of // preference. const char* const pHbShapers[] = { "graphite2", "ot", "fallback", nullptr }; - bool ok - = hb_shape_full(pHbFont, m_pHbBuffer, maFeatures.data(), maFeatures.size(), pHbShapers); - assert(ok); - (void)ok; + if (!hb_shape_full(pHbFont, m_pHbBuffer, maFeatures.data(), maFeatures.size(), pHbShapers)) + { + SAL_WARN("vcl.harfbuzz", "hb_shape_full failed"); + hb_buffer_set_length(m_pHbBuffer, 0); + } int nRunGlyphCount = hb_buffer_get_length(m_pHbBuffer); hb_glyph_info_t* pHbGlyphInfos = hb_buffer_get_glyph_infos(m_pHbBuffer, nullptr); @@ -595,9 +596,11 @@ bool GenericSalLayout::LayoutText(vcl::text::ImplLayoutArgs& rArgs, const SalLay // The shapers that we want HarfBuzz to use, in the order of // preference. const char*const pHbShapers[] = { "graphite2", "ot", "fallback", nullptr }; - bool ok = hb_shape_full(pHbFont, pHbBuffer, maFeatures.data(), maFeatures.size(), pHbShapers); - assert(ok); - (void) ok; + if (!hb_shape_full(pHbFont, pHbBuffer, maFeatures.data(), maFeatures.size(), pHbShapers)) + { + SAL_WARN("vcl.harfbuzz", "hb_shape_full failed"); + hb_buffer_set_length(pHbBuffer, 0); + } // Populate glyph cluster remapping data stClusterMapper.ShapeSubRun(pStr, nLength, aSubRun, pHbFont, maFeatures, oHbLanguage); -- 2.30.2